package main

import (
	"flag"
	"fmt"
	"log"
	"magGo/src/disruption"
	"magGo/src/method3"
	"magGo/src/pagecal"
	"magGo/src/store"
	"net/http"
	_ "net/http/pprof"
)

var Mode = flag.Int("mode", 0, "Input mode 1,")

func main() {

	go func() {
		http.ListenAndServe("0.0.0.0:8080", nil)
	}()
	args := flag.Args()
	if len(args) < 0 {
		fmt.Println("请输入参数")
		return
	}
	flag.Parse()
	log.Println(*Mode)
	switch *Mode {
	case 1:
		log.Println("start dump ")
		store.DumpAllLinksChanRef()
	case 2:
		a := disruption.ReadAllLinks()
		log.Printf("%+v", len(*a))
	case 3:
	case 4:
		log.Println("计算所有学科全量的颠覆度")
		disruption.HandalMain()
	case 5:
		a := disruption.ReadAllLinksChan()
		log.Printf("%+v", len(*a))
	case 6:
		log.Println("test method2")
		disruption.Mathod2_try()
	case 7:
		log.Println("计算 每篇文章的 D")
		disruption.CalPageD()
	case 8:
		log.Println("method3 test")
		method3.HandalTest()
	case 9:
		log.Println("method3 main")
		method3.HandalMain()
	case 10:
		log.Println("start store cal ")
		store.CalPageD()
	case 11:
		log.Println("start subject dump")
		store.DumpsSubject()
	case 12:
		log.Println("start page cal")
		pagecal.StatisticsAllSubject()
	case 13:
		log.Println("start page 幂律")
		pagecal.PowerLowAllSubject()
	case 14:
		log.Println("start dump year")
		store.DumpAllYear()
	case 15:
		log.Println("start page 幂律 by year")
		pagecal.PowerLowAllSubjectByYear()

	default:
		log.Println("do nothing")
	}
}
